<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let arr = [2, 4, 5646, 34, 34, 6545, 65, 453, 4234, 23, 434];

        function tab(a, b) {
            if (a > b) {
                return 1;
            } else if (a == b) {
                return 0;
            } else {
                return -1;
            }
        }
        let a = arr.sort(tab);
        console.log(a);
    </script>
</body>

</html>